import React from 'react';
import { capitalize } from 'utils';
import { NotFound } from 'components';
import Layout from './layout';
import Home from 'src/pages/home/index';
import type { RouteObject } from 'react-router-dom';
import { Navigate } from 'react-router-dom'



const Redirect = (props) => {
    const { to } = props;
    window.location.href = to;
    return <div></div>;
};

export const routes: RouteObject[] = [

    {
        path: '/',
        element: <Layout />,
        children: [
            {
                index: true,  // 匹配 '/'
                element: <Navigate to="/generate" replace />, // 重定向
            },
            {
                path: 'generate',
                element: <Home />,
            },
            {
                path: 'demolist',
                element: <div>第二页</div>,
            },
        ]
    },
    {
        path: '*',
        element: <Layout />,
    }
];
